package com.kgc.controller;

import com.kgc.entity.Completion;
import com.kgc.service.CompletionService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Bankblankfillingquestion)表控制层
 *
 * @author unicorn
 * @since 2020-05-21 19:44:29
 */
@RestController
@RequestMapping("completion")
public class CompletionController {
    /**
     * 服务对象
     */
    @Resource
    private CompletionService completionService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Completion selectOne(@RequestParam("id") Integer id) {
        return this.completionService.queryById(id);
    }

    @GetMapping(value = "queryCompletion")
    public List<Completion> queryCompletion() {
        return this.completionService.queryCompletion();
    }

    @GetMapping(value = "conditionalQuery")
    public List<Completion> conditionalQuery(@RequestBody Completion completion) {
        return this.completionService.queryAll(completion);
    }

    @GetMapping(value = "deleteCompletion")
    public Integer deleteCompletion(@RequestParam("id") Integer id) {
        return this.completionService.deleteById(id);
    }

    @PostMapping(value = "updateCompletion")
    public Integer updateCompletion(@RequestBody Completion completion) {
        return this.completionService.update(completion);
    }

    @PostMapping(value = "insertCompletion")
    public Integer insertCompletion(@RequestBody Completion completion) {
        return this.insertCompletion(completion);
    }
}